<template>
	<view>
		<view class="p2">
			<view class="flex " style="flex-wrap: wrap;">
				<view v-for="(item,index) in list" :key="index" @click="on_ad(index,item)" class="flex a-c  ge50">
					<image class="o-img" :src="item.img|getImg">
					</image>
					<view class="ml2">
						<text class="w800">{{item.name}}</text>
					</view>
				</view>
			</view>
			<view class="flex j-c a-c c_7" v-if="list.length==0" style="height: 40vh;">
				暂无其他工具
			</view>
			<ad :unit-id="weixin_banner_ad"></ad>

		</view>
		<tabbar></tabbar>
	</view>
</template>

<script>
	import $plugin from '@/common/plugin/dianzishouxieqianming/dianzishouxieqianming.js';
	export default {
		data() {
			return {
				list: [],
				weixin_banner_ad: ""
			}
		},
		watch: {
			get_plugin_set: {
				handler: function(newVal, oldVal) {
					if (newVal != 0) {
						this.weixin_banner_ad = newVal.weixin_banner_ad
					 
					}
				},
				immediate: true
			}
		},
		onLoad() {
			this.ad_init();
		},
		methods: {
			on_ad(index, item) {
				$plugin.ad_jump(item);
			},
			async ad_init() {
				let that = this;
				let requestParams = {
					page: 1,
				};
				const ret = await this.Http.post('/plugin.php/dianzishouxieqianming/api/Ad/lists', requestParams)
				if (ret.status == 200) {
					let list = ret.data.list.list.data;
					this.list = list;


				}
			},

		}
	}
</script>

<style>
	page {
		background-color: #F4F3F8;
	}

	.ge50 {
		background-color: #fff;
		width: 45%;
		padding: 20rpx;
		border-radius: 10rpx;
		margin: 2.5%;
	}

	.o-img {
		width: 80rpx;
		height: 80rpx;
		border-radius: 99rpx;
	}
</style>